home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / HARDWARE / IICALARM / !iicAlarm / SwitchOff (.txt) < prev   
RISC OS BBC BASIC V Source  |  1994-05-04  |  2KB  |  58 lines

  1.  > SwitchOff040
  2.  Shutdown the computer without user interference.
  3.  This is the rude method and the data in running Applikations
  4.  will be lost.
  5.  We simply set the IO-lines to switch off the computer.
  6. +4096
  7.  "Error in ";
  8. I*IF "<Wimp$State>" = "commands" THEN Echo Automatic Shutdown started.
  9. switchoff
  10. switchoff
  11.  We have a Desktop and some running Applikations.
  12.  ok. We ignore them.
  13.  But we can close open files and park disks aso.
  14.    *Shutdown
  15.     a = 
  16. initSwitchOffRoutine
  17.  code%=0 
  18.  0,"**** SwitchOff **** Where is my code ??"
  19. "Hourglass_Start", 1
  20.  Set both Aux1/2-lines
  21.    A% = 3
  22.  AuxSet
  23.    tm% = 
  24.  + 1500
  25.  .     
  26. "Hourglass_Percentage", (tm%-
  27. )/100
  28.    A% = 0
  29.  AuxSet
  30. "Hourglass_Off"
  31. 'C; Initialise a Routine to set the Aux1/2-lines of the computer.
  32. (I; Returns the address of the routine. Call by 
  33.  with A% as Parameter.
  34. initSwitchOffRoutine
  35.  LatAdr, pc, sp, link
  36.    code% 128
  37. ,!pc = 15 : sp = 13 : link = 14
  38. P% = code%
  39. [        OPT      0
  40.          ALIGN
  41. 0A.LatAdr  EQUD     &3350018              ; Adresse des Latches
  42. 26; (5) Setze die Aux1/2-Leitungen auf ein Bitmuster
  43. 3/; Entry  R0  Bitmuster fuer Aux1/2 = Bit0,1
  44. ; Exit   -
  45. .AuxSet
  46. 7(         stmfd    (sp)!,{r0,r1,link}
  47. 8O         SWI      "XOS_EnterOS"         ; Reset nur im Supervisor moeglich.
  48.          MOV      r0, r0
  49. :F         ldr      r1, LatAdr            ; lade Adresse des Latch B
  50. ;H         and      r0, r0, #3            ; nur Bits 0 und 1 zulassen.
  51. <M         mov      r0, r0, LSL #5        ; an die richtige Stelle bringen.
  52. =L         orr      r0, r0, #%00001000    ; Disc-Controller-Reset inaktiv.
  53. >F         strb     r0, [r1]              ; speichere Date als Byte.
  54. ?P         teqp     pc, #0                ; Usermode setzen und Interruts ein.
  55.          mov      r0, r0
  56. A&         ldmfd    (sp)!,{r0,r1,pc}
  57. = AuxSet
  58.